package com.team.sion.mapper;

import com.team.sion.pojo.RankList;
import com.team.sion.pojo.RankListExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface RankListMapper {
    long countByExample(RankListExample example);

    int deleteByExample(RankListExample example);

    @Delete({
        "delete from ranklist",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into ranklist (id, songList_id, ",
        "user_id, score)",
        "values (#{id,jdbcType=INTEGER}, #{songListId,jdbcType=INTEGER}, ",
        "#{userId,jdbcType=INTEGER}, #{score,jdbcType=INTEGER})"
    })
    int insert(RankList row);

    int insertSelective(RankList row);

    List<RankList> selectByExample(RankListExample example);

    @Select({
        "select",
        "id, songList_id, user_id, score",
        "from ranklist",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.team.sion.mapper.RankListMapper.BaseResultMap")
    RankList selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("row") RankList row, @Param("example") RankListExample example);

    int updateByExample(@Param("row") RankList row, @Param("example") RankListExample example);

    int updateByPrimaryKeySelective(RankList row);

    @Update({
        "update ranklist",
        "set songList_id = #{songListId,jdbcType=INTEGER},",
          "user_id = #{userId,jdbcType=INTEGER},",
          "score = #{score,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(RankList row);
}